-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support $ref #1208
feat: support $ref #1208
Conversation
if (reachable.has(typeName)) { | ||
// we've already processed this definition | ||
const typeName = decodeURIComponent(definition.$ref.slice(DEFINITION_OFFSET)); | ||
if (reachable.has(typeName) || !isLocalRef(definition.$ref)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is too late. At this point we already generated the schema. It would be better to not even recurse into types when we have a ref.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I'll look into it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated AnnotatedNodeParser
such that it short-circuits child type parsing if an explicit ref
annotation was provided.
Instead, it sets the child type to AnyType
. The AnyType is conveniently represented as an empty object which means we'll only get the $ref
property in the output schema and no additional noise coming from the type itself.
nested: MyNestedObject | ||
|
||
/** | ||
* @ref http://json-schema.org/draft-07/schema# |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does json schema support additional properties here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand. What do you mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also add a comment here and see that in the description of the json schema property?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done 👍
Thank you |
🚀 PR was released in |
fixes #1207
Version
Published prerelease version:
v1.1.0-next.0
Changelog
🎉 This release contains work from a new contributor! 🎉
Thank you, Hadrien Milano (@hmil), for all your work!
🚀 Enhancement
🐛 Bug Fix
@description
#1177 (@Jason3S)🔩 Dependency Updates
Authors: 4